package k8s

import (
	"context"
	appsv1 "k8s.io/api/apps/v1"
	corev1 "k8s.io/api/core/v1"
)

type K8sClient interface {
	// Deployment相关的方法
	CreateDeploymentFromYamlStr(c context.Context, req *CreateDeploymentFromYamlStrRequest) (*appsv1.Deployment, error)
	DeleteDeployment(c context.Context, req *DeleteDeploymentRequest) (*appsv1.Deployment, error)
	GetDeployment(c context.Context, req *GetDeploymentRequest) (*appsv1.Deployment, error)
	ListDeployment(c context.Context, req *ListDeploymentRequest) (*appsv1.DeploymentList, error)
	PatchDeploymentFromJson(c context.Context, req *PatchDeploymentFromJsonRequest) (*appsv1.Deployment, error)
	PutDeploymentFromYaml(c context.Context, req *PutDeploymentFromYamlRequest) (*appsv1.Deployment, error)
	GetDeploymentPods(c context.Context, req *GetDeploymentPodsRequest) (*corev1.PodList, error)
	ExecCommandOnDeploymentPods(c context.Context, req *ExecCommandOnDeploymentPodsRequest) (map[string][]byte, map[string]error, error)

	// Pod相关的方法
	CreatePod(c context.Context, req *CreatePodRequest) (*corev1.Pod, error)
	ListPod(c context.Context, req *ListPodRequest) (*corev1.PodList, error)
	GetPod(c context.Context, req *GetPodRequest) (*corev1.Pod, error)
	ExecInPod(c context.Context, req *ExecInPodRequest) ([]byte, []byte, error)
	PatchPodFromJson(c context.Context, req *PatchPodFromJsonRequest) (*corev1.Pod, error)
	PutPodFromYaml(c context.Context, req *PutPodFromYamlRequest) (*corev1.Pod, error)
	DeletePod(c context.Context, req *DeletePodRequest) (*corev1.Pod, error)
	GetPodStatus(c context.Context, req *GetPodStatusRequest) (*GetPodStatusResponse, error)

	// Service相关方法
	CreateService(c context.Context, req *CreateServiceRequest) (err error)
	DeleteService(c context.Context, req *DeleteServiceRequest) error
	GetService(c context.Context, req *GetServiceRequest) (*corev1.Service, error)

	// ConfigMap相关方法
	CreateOrUpdateConfigMapFromYaml(c context.Context, req *CreateOrUpdateConfigMapFromYamlRequest) (*corev1.ConfigMap, error)
	CreateOrUpdateConfigMapFromFiles(ctx context.Context, req *CreateOrUpdateConfigMapFromFilesRequest) (*corev1.ConfigMap, error)
	CreateOrUpdateConfigMapFromJson(c context.Context, req *CreateOrUpdateConfigMapFromJsonRequest) (*corev1.ConfigMap, error)
	GetConfigMap(c context.Context, req *GetConfigMapRequest) (*corev1.ConfigMap, error)
	ListConfigMap(c context.Context, req *ListConfigMapRequest) (*corev1.ConfigMapList, error)
	DeleteConfigMap(c context.Context, req *DeleteConfigMapRequest) (*corev1.ConfigMap, error)

	// workload resource相关方法
	GetDeploymentResourceMetrics(c context.Context, req *RequestWorkloads) (*ResponseResourceMetrics, error)
	GetStatefulSetResourceMetrics(c context.Context, req *RequestWorkloads) (*ResponseResourceMetrics, error)
	GetDaemonSetResourceMetrics(c context.Context, req *RequestWorkloads) (*ResponseResourceMetrics, error)
	GetJobResourceMetrics(c context.Context, req *RequestWorkloads) (*ResponseResourceMetrics, error)
	GetCronJobResourceMetrics(c context.Context, req *RequestWorkloads) (*ResponseResourceMetrics, error)
}
